import os
import time
from selenium import webdriver
from selenium.webdriver.common.by import By

# 打开浏览器
driver = webdriver.Chrome()
url = 'file:///' + os.path.abspath('html') + '\\radio-checkbox.html'
driver.get(url)

# 单选按钮
time.sleep(2)
driver.find_element(By.ID,'boy').click()
print(driver.find_element(By.ID, 'boy').is_selected())

time.sleep(2)
driver.find_element(By.ID,'girl').click()
print(driver.find_element(By.ID, 'girl').is_selected())

# 退出浏览器
time.sleep(2)
driver.quit()